package com.software.task.validation;

import com.software.task.anno.State;
import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext;


/**
 * @author lj20050120
 */
public class StateValidation implements ConstraintValidator<State, String> {

    /**
     * @param value 将来要校验的数据
     * @param context in which the constraint is evaluated
     *
     *
     * @return 如果校验通过则返回true，否则返回false
     */


    @Override
    public boolean isValid(String value, ConstraintValidatorContext context) {
        //提供校验规则
        if(value==null){
            return false;
        }
        return "已提交".equals(value) || "草稿".equals(value);
    }
}
